Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

make sure needle is converted to string before calling strpos#73

Open
madmuffin1 wants to merge 2 commits intoAnahkiasen:masterfrom
madmuffin1:fix-matching-numeric-prefixes
Open

make sure needle is converted to string before calling strpos#73
madmuffin1 wants to merge 2 commits intoAnahkiasen:masterfrom
madmuffin1:fix-matching-numeric-prefixes

Conversation

@madmuffin1
Copy link

I had (a rather edge case) where Strings::startsWith was called from an Arrays::each closure similar to this:

$string = "12345";

Arrays::each([
    '1234' => "jey"
], function($value, $key) use ($string) {
    if(Strings::startsWith($string, $key)) {
        print_r("match");
    }
});

this would never match, since the key is automagically converted into an integer and strpos($haystack, INTEGER) will never match.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant